From f909827ad1edc118c3ffcca8f5532369b7b14282 Mon Sep 17 00:00:00 2001 From: "ewan@linford.intra" Date: Tue, 13 Sep 2005 14:42:21 +0100 Subject: [PATCH] Pass the root directory to Doxyfilter and thence pythfilter.py so that the latter can get the namespace/packages correct. --- docs/Doxyfile | 2 +- docs/pythfilter.py | 29 ++++++++++++++++++++++++----- 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/docs/Doxyfile b/docs/Doxyfile index 8048a38077..21b06aa07f 100644 --- a/docs/Doxyfile +++ b/docs/Doxyfile @@ -519,7 +519,7 @@ IMAGE_PATH = # to standard output. If FILTER_PATTERNS is specified, this tag will be # ignored. -INPUT_FILTER = "sh ./Doxyfilter" +INPUT_FILTER = "sh ./Doxyfilter ../tools/python" # The FILTER_PATTERNS tag can be used to specify filters on a per file pattern # basis. Doxygen will compare the file name with each pattern and apply the diff --git a/docs/pythfilter.py b/docs/pythfilter.py index 81a13d9973..3054f7caf3 100644 --- a/docs/pythfilter.py +++ b/docs/pythfilter.py @@ -469,12 +469,25 @@ def dump(filename): sys.stdout.write(s) def filter(filename): - global name, module_has_docstring + global name, module_has_docstring, source_root path,name = os.path.split(filename) root,ext = os.path.splitext(name) - output("namespace "+root+" {\n",(0,0)) + if source_root and path.find(source_root) == 0: + path = path[len(source_root):] + + if path[0] == os.sep: + path = path[1:] + + ns = path.split(os.sep) + else: + ns = [] + + ns.append(root) + + for n in ns: + output("namespace " + n + " {\n",(0,0)) # set module name for tok_eater to use if there's a module doc string name = root @@ -486,7 +499,9 @@ def filter(filename): print_comment((0,0)) output("\n",(0,0)) - output("} // end of namespace\n",(0,0)) + + for n in ns: + output("} // end of namespace\n",(0,0)) if not module_has_docstring: # Put in default namespace documentation @@ -611,9 +626,10 @@ def convert(srcpath, destpath): ###################################################################### filter_file = False +source_root = None try: - opts, args = getopt.getopt(sys.argv[1:], "hf", ["help"]) + opts, args = getopt.getopt(sys.argv[1:], "hfr:", ["help"]) except getopt.GetoptError,e: print e sys.exit(1) @@ -622,10 +638,13 @@ for o,a in opts: if o=="-f": filter_file = True + if o=="-r": + source_root = os.path.abspath(a) + if filter_file: # Filter the specified file and print the result to stdout filename = string.join(args) - filterFile(filename) + filterFile(os.path.abspath(filename)) else: if len(args)!=2: -- 2.30.2